package com.my.structuraltype.composite;

import java.util.ArrayList;
import java.util.List;

public class HeadCompany extends Company {
	
	private List<Company> children = new ArrayList<Company>();
	
	public HeadCompany(String name, int grade) {
		super(name, grade);
	}

	@Override
	public void add(Company company) {
		children.add(company);

	}

	@Override
	public void remove(Company company) {
		children.remove(company);
	}
	
	@Override
	public void display() {
		super.display();
		for(Company c: children) {
			c.display();
		}
	}

}
